﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:WPF="clr-namespace:TraceInspector.UI.WPF.Views"
                    xmlns:avalonLayout="clr-namespace:Xceed.Wpf.AvalonDock.Layout;assembly=Xceed.Wpf.AvalonDock"
                    xmlns:ViewModel="clr-namespace:TraceInspector.ViewModel;assembly=TraceInspector.ViewModel"
                    xmlns:model="clr-namespace:TraceInspector.Model;assembly=TraceInspector.Model"
                    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                    xmlns:Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4"
                    xmlns:metro="clr-namespace:Xceed.Wpf.AvalonDock.Themes;assembly=Xceed.Wpf.AvalonDock.Themes.Metro"
                    xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
                    xmlns:Converters="clr-namespace:MahApps.Metro.Converters;assembly=MahApps.Metro"
                    >

    <ResourceDictionary.MergedDictionaries>
        <!--<ResourceDictionary Source="Controls.DataGrid.xaml"></ResourceDictionary>-->
    </ResourceDictionary.MergedDictionaries>

    <Converters:ToUpperConverter x:Key="ToUpperConverter" />

    
    
    <Style x:Key="{ComponentResourceKey ResourceId=MetroDataGridSelectAllButtonStyle, TypeInTargetAssembly={x:Type DataGrid}}" TargetType="{x:Type Button}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid>
                        <Rectangle x:Name="Border" SnapsToDevicePixels="True">
                            <Rectangle.Resources>
                                <Style TargetType="{x:Type Rectangle}">
                                    <Setter Property="Fill">
                                        <Setter.Value>
                                            <SolidColorBrush Color="{DynamicResource AccentColor2}"/>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </Rectangle.Resources>
                        </Rectangle>
                        <Polygon x:Name="Arrow" Fill="Black" HorizontalAlignment="Right" Margin="8,8,3,3" Opacity="0.15" Points="0,10 10,10 10,0" Stretch="Uniform" VerticalAlignment="Bottom"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="Fill" TargetName="Border">
                                <Setter.Value>
                                    <SolidColorBrush Color="{DynamicResource AccentColor}"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Visibility" TargetName="Arrow" Value="Collapsed"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="MetroColumnHeaderGripperStyle" TargetType="{x:Type Thumb}">
        <Setter Property="Width" Value="8"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Cursor" Value="SizeWE"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="MetroRowHeaderGripperStyle" TargetType="{x:Type Thumb}">
        <Setter Property="Width" Value="8"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Cursor" Value="SizeWE"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="MetroDataGridColumnHeader" TargetType="{x:Type DataGridColumnHeader}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="MinWidth" Value="0" />
        <Setter Property="MinHeight" Value="28" />
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="FontWeight" Value="SemiBold"/>
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
                    <Grid>
                        <Border x:Name="BackgroundBorder" BorderThickness="0,0,0,0" 
                        Background="{DynamicResource ControlBackgroundBrush}" 
                        BorderBrush="{DynamicResource ControlBorderBrush}" 
                        Grid.ColumnSpan="2" SnapsToDevicePixels="True" />
                        <Grid>
                            <Grid.Resources>
                                <Style TargetType="{x:Type Grid}">
                                    <Setter Property="Background">
                                        <Setter.Value>
                                            <SolidColorBrush Color="{DynamicResource AccentColor}"/>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </Grid.Resources>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <TextBlock Margin="6,3,6,3" VerticalAlignment="Center" Text="{TemplateBinding Content, Converter={StaticResource ToUpperConverter}}" TextWrapping="WrapWithOverflow"/>

                            <Path x:Name="SortArrow" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill" 
                              Grid.Column="1" Width="8" Height="6" Fill="White" Margin="0,0,8,0" 
                              VerticalAlignment="Center" RenderTransformOrigin="0.5,0.4" Visibility="Hidden" />
                        </Grid>
                        <Thumb x:Name="PART_LeftHeaderGripper" HorizontalAlignment="Left" 
                        Style="{StaticResource MetroColumnHeaderGripperStyle}"/>
                        <Thumb x:Name="PART_RightHeaderGripper" HorizontalAlignment="Right" 
                        Style="{StaticResource MetroColumnHeaderGripperStyle}"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="SortDirection" Value="Ascending">
                            <Setter TargetName="SortArrow" Property="Visibility" Value="Visible" />
                            <Setter TargetName="SortArrow" Property="RenderTransform">
                                <Setter.Value>
                                    <RotateTransform Angle="180" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="SortDirection" Value="Descending">
                            <Setter TargetName="SortArrow" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <Trigger Property="DisplayIndex" Value="0">
                            <Setter Property="Visibility" Value="Collapsed" 
                                  TargetName="PART_LeftHeaderGripper"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="MetroDataGridRowHeader" TargetType="{x:Type DataGridRowHeader}">
        <Setter Property="Background" Value="{DynamicResource ControlBackgroundBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridRowHeader}">
                    <Grid>
                        <Border  BorderBrush="{Binding HorizontalGridLinesBrush, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" 
                                 Background="{TemplateBinding Background}"                                     
                                 BorderThickness="0,0,0,0" 
                                 Padding ="{TemplateBinding Padding}" 
                                 Margin="0,0,0,0"
                                 SnapsToDevicePixels="True">
                            <StackPanel Orientation="Horizontal">
                                <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                                  VerticalAlignment="Center"/>
                            </StackPanel>
                        </Border>
                        <Thumb x:Name="PART_TopHeaderGripper" 
                            VerticalAlignment="Top" Height="3" 
                            Style="{StaticResource MetroRowHeaderGripperStyle}"/>
                        <Thumb x:Name="PART_BottomHeaderGripper" 
                            VerticalAlignment="Bottom" Height="3" 
                            Style="{StaticResource MetroRowHeaderGripperStyle}"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background">
                                <Setter.Value>
                                    <SolidColorBrush Color="{DynamicResource AccentColor3}" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsRowSelected" Value="True">
                            <Setter Property="Background">
                                <Setter.Value>
                                    <SolidColorBrush Color="{DynamicResource AccentColor2}" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="MetroDataGridCellStyle" TargetType="{x:Type DataGridCell}">
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="BorderBrush">
            <Setter.Value>
                <SolidColorBrush Color="Transparent" />
            </Setter.Value>
        </Setter>
        <Setter Property="MinHeight" Value="25"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridCell}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" 
                            Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                        <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" 
                                          Content="{TemplateBinding Content}" 
                                          ContentStringFormat="{TemplateBinding ContentStringFormat}" 
                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                          VerticalAlignment="Center"
                                          Margin="2"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="BorderBrush">
                    <Setter.Value>
                        <SolidColorBrush Color="{DynamicResource AccentColor2}" />
                    </Setter.Value>
                </Setter>
                <Setter Property="Background">
                    <Setter.Value>
                        <SolidColorBrush Color="{DynamicResource AccentColor2}" />
                    </Setter.Value>
                </Setter>
            </Trigger>
            <MultiTrigger>

                <MultiTrigger.Conditions>

                    <Condition Property="IsSelected" Value="True"/>

                    <Condition Property="IsFocused" Value="True"/>

                </MultiTrigger.Conditions>

                <Setter Property="Background">

                    <Setter.Value>

                        <SolidColorBrush Color="{DynamicResource AccentColor3}" />

                    </Setter.Value>

                </Setter>

                <Setter Property="BorderBrush">

                    <Setter.Value>

                        <SolidColorBrush Color="{DynamicResource AccentColor3}" />

                    </Setter.Value>

                </Setter>

            </MultiTrigger>

            <Trigger Property="IsMouseOver" Value="True">

                <Setter Property="Background">

                    <Setter.Value>

                        <SolidColorBrush Color="{DynamicResource AccentColor3}" />

                    </Setter.Value>

                </Setter>

                <Setter Property="BorderBrush">

                    <Setter.Value>

                        <SolidColorBrush Color="{DynamicResource AccentColor3}" />

                    </Setter.Value>

                </Setter>

                <Setter Property="Foreground" Value="White"/>

            </Trigger>

        </Style.Triggers>

    </Style>

    <Style TargetType="{x:Type DataGrid}">
        <Setter Property="Background" Value="{DynamicResource WhiteColorBrush}" />
        <Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
        <Setter Property="BorderBrush" Value="{DynamicResource AccentColorBrush}"/>
        <Setter Property="BorderThickness" Value="0,0,0,0"/>
        <Setter Property="RowDetailsVisibilityMode" Value="VisibleWhenSelected"/>
        <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
        <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        <Setter Property="GridLinesVisibility" Value="None"/>
        <Setter Property="HorizontalGridLinesBrush" Value="{DynamicResource ControlBorderBrush}"/>
        <Setter Property="VerticalGridLinesBrush" Value="{DynamicResource ControlBorderBrush}"/>
        <Setter Property="FontSize" Value="12"/>
        <Setter Property="CellStyle" Value="{StaticResource MetroDataGridCellStyle}" />
        <Setter Property="RowHeaderStyle" Value="{StaticResource MetroDataGridRowHeader}"/>
        <Setter Property="ColumnHeaderStyle"  Value="{StaticResource MetroDataGridColumnHeader}"/>
        
        <Setter Property="AlternatingRowBackground">
            <Setter.Value>
                <SolidColorBrush Color="{DynamicResource Gray7}"/>
            </Setter.Value>
        </Setter>
        <Setter Property="DropLocationIndicatorStyle">
            <Setter.Value>
                <Style TargetType="Separator">
                    <Setter Property="Background">
                        <Setter.Value>
                            <SolidColorBrush Color="{DynamicResource Gray5}"/>
                        </Setter.Value>
                    </Setter>
                    <Setter Property="Width" Value="2"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="Separator">
                                <Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGrid}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True">
                        <ScrollViewer x:Name="DG_ScrollViewer" Focusable="false">
                            <ScrollViewer.Template>
                                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="*"/>
                                            <RowDefinition Height="Auto"/>
                                        </Grid.RowDefinitions>
                                        <Button Command="{x:Static DataGrid.SelectAllCommand}" Focusable="false" Style="{DynamicResource {ComponentResourceKey ResourceId=MetroDataGridSelectAllButtonStyle, TypeInTargetAssembly={x:Type DataGrid}}}" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.All}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" Width="{Binding CellsPanelHorizontalOffset, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                                        <DataGridColumnHeadersPresenter x:Name="PART_ColumnHeadersPresenter" Grid.Column="1" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Column}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
                                        <Grid Grid.Row="1" Grid.ColumnSpan="2">
                                            <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" Grid.ColumnSpan="2" Grid.Row="1"/>
                                        </Grid>
                                        <ScrollBar x:Name="PART_VerticalScrollBar" Grid.Column="2" Maximum="{TemplateBinding ScrollableHeight}" Orientation="Vertical" Grid.Row="1" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>
                                        <Grid Grid.Column="1" Grid.Row="2">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="{Binding NonFrozenColumnsViewportHorizontalOffset, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                                                <ColumnDefinition Width="*"/>
                                            </Grid.ColumnDefinitions>
                                            <ScrollBar x:Name="PART_HorizontalScrollBar" Grid.Column="1" Maximum="{TemplateBinding ScrollableWidth}" Orientation="Horizontal" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
                                        </Grid>
                                    </Grid>
                                </ControlTemplate>
                            </ScrollViewer.Template>
                            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsGrouping" Value="true">
                <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    

    <DataTemplate DataType="{x:Type ViewModel:InspectionListViewModel}">

        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="80*"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
            </Grid.RowDefinitions>

            <StackPanel Grid.Row="0" Orientation="Horizontal">
                <controls:ToggleSwitch OnLabel="Сервер  " OffLabel="Локальный диск  " IsChecked="{Binding IsServerSource}" Margin="5" Header="Выбор источника" ToolTip="Нажмите для смены источника"></controls:ToggleSwitch>
            </StackPanel>

            <DataGrid Grid.Row="1" x:Name="InspectionListDataGrid" Margin="5" SelectionMode="Single" ItemsSource="{Binding InspectionList}" SelectedItem="{Binding CurrentInspection}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" SelectionUnit="FullRow" IsReadOnly="True" >
                <DataGrid.Columns>
                    <DataGridTextColumn Width="*" Binding="{Binding InspectionMg.Name}" Header="Газопровод"></DataGridTextColumn>
                    <DataGridTextColumn Width="Auto" Binding="{Binding InspectionPlace.Name}" Header="Участок"></DataGridTextColumn>
                    <DataGridTextColumn Width="Auto" Binding="{Binding InspDate,StringFormat={}{0: dd MMMM yyyy}}"  Header="Дата обследования"></DataGridTextColumn>
                    <DataGridTextColumn Width="Auto" Binding="{Binding Diam}"  Header="Диаметр"></DataGridTextColumn>
                    <DataGridTextColumn Width="Auto" Binding="{Binding State}" Header="Состояние"></DataGridTextColumn>
                </DataGrid.Columns>
            </DataGrid>

            <GroupBox Grid.Row="2" Margin="5" Header="Дополнительно" Visibility="{Binding IsSetCurrentInspection,Converter={StaticResource BooleanToVisibilityConverter}}" >
                <Grid DataContext="{Binding CurrentInspection}">
                    <Grid.RowDefinitions>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition></ColumnDefinition>
                    </Grid.ColumnDefinitions>

                    <ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto"  Template="{DynamicResource ScrollViewerTemplate}">
                        <TextBlock FontSize="{DynamicResource NormalFontSize}" VerticalAlignment="Center" Margin="5" >
                            <TextBlock.Text>
                                <MultiBinding StringFormat="{}{0}{1}{2}">
                                    <Binding Path="InspectionMg.Name"></Binding>
                                    <Binding Path="InspectionPlace.Name"></Binding>
                                    <Binding Path="InspectionDate"></Binding>
                                    <Binding Path="InspectionMg.Name"></Binding>
                                    <Binding Path="InspectionMg.Name"></Binding>
                                </MultiBinding>
                            </TextBlock.Text>
                        </TextBlock>
                    </ScrollViewer>

                    <ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto"  Template="{DynamicResource ScrollViewerTemplate}">
                        <StackPanel Orientation="Horizontal">
                            <Label VerticalAlignment="Center">Диаметр :</Label>
                            <TextBlock VerticalAlignment="Center" Text="{Binding Diam}"></TextBlock>
                            <Label VerticalAlignment="Center">Дата постройки :</Label>
                            <TextBlock VerticalAlignment="Center" Text="{Binding MgConstrDate, StringFormat={}{0: dd MMMM yyyy}}"></TextBlock>
                            <Label VerticalAlignment="Center">Рабочее давление :</Label>
                            <TextBlock VerticalAlignment="Center" Text="{Binding WorkPressure}"></TextBlock>
                            <Label VerticalAlignment="Center">Проектное давление :</Label>
                            <TextBlock VerticalAlignment="Center" Text="{Binding DesignPressure}"></TextBlock>
                        </StackPanel>
                    </ScrollViewer>

                    <ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto"  Template="{DynamicResource ScrollViewerTemplate}">
                        <ItemsControl ItemsSource="{Binding Launches}">
                            <ItemsControl.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <StackPanel Orientation="Horizontal"></StackPanel>
                                </ItemsPanelTemplate>
                            </ItemsControl.ItemsPanel>
                            
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock>
                                        <TextBlock.Text>
                                            <MultiBinding StringFormat="{}{0} {1} {2}">
                                                <Binding Path="LaunchDevice.Name"></Binding>
                                                <Binding Path="StartDate" ></Binding>
                                                <Binding Path="EndDate" ></Binding>
                                            </MultiBinding>
                                        </TextBlock.Text>
                                    </TextBlock>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                    </ScrollViewer>



                    <ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto"  Template="{DynamicResource ScrollViewerTemplate}">
                        <TextBlock VerticalAlignment="Center" Text="{Binding Misc,StringFormat={}{0}}"></TextBlock>
                    </ScrollViewer>
                    
                    
                </Grid>
                
                
            </GroupBox>

            <StackPanel Grid.Row="3" Margin="5" Orientation="Horizontal">
                <Button Command="{Binding SelectInspectionCommand}">Редактировать</Button>
                <Button IsEnabled="False">Добавить</Button>
                <Button IsEnabled="False">Удалить</Button>
            </StackPanel>
        </Grid>


    </DataTemplate>

    <DataTemplate DataType="{x:Type ViewModel:EditInspectionViewModel}">
        <TabControl ItemsSource="{Binding Tools}" Margin="5" IsSynchronizedWithCurrentItem="True">
            <TabControl.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <ContentPresenter Content="{Binding Title}"/>
                        <Button Width="Auto" VerticalAlignment="Center" Height="Auto" Margin="5" Command="{Binding CloseCommand}" Visibility="{Binding CanClose, Converter={StaticResource BooleanToVisibilityConverter}}">X</Button>
                    </StackPanel>
                </DataTemplate>
            </TabControl.ItemTemplate>
        </TabControl>
    </DataTemplate>
    
    <DataTemplate DataType="{x:Type ViewModel:InspectionDetaisViewModel}" >
        <StackPanel>
            <Label FontSize="16" FontWeight="Bold">Пропуски</Label>
            <DataGrid ItemsSource="{Binding InspectionModel.Launches}" SelectedItem="{Binding SelectedLaunchModel}" CanUserAddRows="False" CanUserDeleteRows="False" SelectionUnit="FullRow" IsReadOnly="True">
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="MouseDoubleClick">
                        <Command:EventToCommand Command="{Binding ShowLaunchCommand}"></Command:EventToCommand>
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </DataGrid>
        </StackPanel>
    </DataTemplate>
    
    <DataTemplate DataType="{x:Type ViewModel:LaunchViewModel}">
        <StackPanel>
            <ListBox ItemsSource="{Binding LaunchModel.Tubes}"></ListBox>
        </StackPanel>
    </DataTemplate>

    <DataTemplate DataType="{x:Type ViewModel:ReportViewModel}">
        
    </DataTemplate>























   



</ResourceDictionary>